package com.example.springbootexamples;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;

public class guava {
    @Test
    public void t(){

        LoadingCache<Long, Map<String,Object>> graphs = CacheBuilder.newBuilder()

                .build(new CacheLoader<Long, Map<String, Object>>() {
            @Override
            public Map<String, Object> load(Long aLong) throws Exception {
                return new HashMap<>();
            }
        });


        try {
            Map<String,Object> map=graphs.get(1l);
            System.out.println(map);
        } catch (ExecutionException e) {
            e.printStackTrace();
        }


    }
}
